window.phoenix&&(window.phoenix.buildInfo||(window.phoenix.buildInfo=[]),-1===window.phoenix.buildInfo.findIndex((e=>"Phoenix-upper-funnel"===e.MFE))&&window.phoenix.buildInfo.push({MFE:"Phoenix-upper-funnel",VERSION:"release-phoenix-upper-funnel-1.1.34939.1371721126-39f68b2d-4-g4c3fc7698",LASTCOMMITDATETIME:"2024-07-16T18:00:25-06:00"})) /*! * * ============= BUILD INFO ============= * MFE: Phoenix-upper-funnel * chunkName: page-clientlibs/magenta/product-listing-page/product-listing-page * VERSION: release-phoenix-upper-funnel-1.1.34939.1371721126-39f68b2d-4-g4c3fc7698 * BRANCH: release/fix-upper-funnel0717 * COMMITHASH: 4c3fc7698bddb05cca402d984d9c7e93c1830225 * LASTCOMMITDATETIME: 2024-07-16T18:00:25-06:00 * ============= If you're reading this, why not come work with us? https://www.t-mobile.com/careers ============= */,function(){"use strict";var e={4917:function(e,t,o){o.d(t,{Bz:function(){return n},r0:function(){return r}});o(4674);function n(){return"authenticated"===document.body.getAttribute("data-auth-state")?.toLowerCase()}const r={urlEncode:e=>btoa(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}},4674:function(e,t,o){o.d(t,{M:function(){return n}});const n={CUSTOMER_SELECTED_LINE:"CUSTOMER_SELECTED_LINE",PDP_CURRENT_URL:"PDP_CURRENT_URL",UPF_EXPERIENCE:"PDP_UPF_EXPERIENCE",UPGRADE_CUSTOMER_INFO:"UPGRADE_CUSTOMER_INFO",SELECTED_PAYMENT_OPTION:"SELECTED_PAYMENT_OPTION",PDP_COMPATIBLE_PLAN_SOC:"PDP_COMPATIBLE_PLAN_SOC",PDP_PENDING_PLAN_SOC:"PDP_PENDING_PLAN_SOC",PDP_PRODUCT_PRICING:"PDP_PRODUCT_PRICING",PDP_CURRENT_SKU_CODE:"PDP_CURRENT_SKU_CODE",PDP_SELECTED_STORE:"PDP_SELECTED_STORE",PDP_IN_STOCK_STORE_ID:"PDP_IN_STOCK_STORE_ID",PDP_IN_STOCK_STORE_ZIP:"PDP_IN_STOCK_STORE_ZIP",TRANSACTION_TYPE:"PDP_TRANSACTION_TYPE",COMPONENT_SHOW_HIDE_STATE:"COMPONENT_SHOW_HIDE_STATE",PDP_STOCK_STATUS:"PDP_STOCK_STATUS",PDP_PORT_IN_INFO:"PDP_PORT_IN_INFO",CART_CURRENT_LINE_ID:"CART_CURRENT_LINE_ID",CUSTOMER_UPGRADE_MSISDN:"CUSTOMER_UPGRADE_MSISDN",CUSTOMER_TRADE_IN_ACCEPTED:"CUSTOMER_TRADE_IN_ACCEPTED",PDP_CURRENT_SKU_ID:"PDP_CURRENT_SKU_ID"}},3898:function(e,t,o){o.d(t,{u:function(){return r}});var n=o(4917);class r{get isProspectiveCustomer(){return!this.isCookiedUser&&!(0,n.Bz)()}get isCookiedUser(){return!(0,n.Bz)()&&Boolean(window.Cookies.get("MyTMobile"))}shouldOpenModal(e){if(this.isProspectiveCustomer)return!1;const t=window.Cookies.get("ShopIntent");if(this.isCookiedUser&&!t)return window.phoenix.bus.publish("SHOW_HIDE","TOGGLE",{payload:{show:["intent_guest"]}}),!0;if((0,n.Bz)()){if(window.phoenix.bus.publish("SHOW_HIDE","TOGGLE",{payload:{hide:["intent_guest"]}}),e&&"ACTIVATION"===e)return!0;if(!e)return!0}return"AAL"!=e&&"UPGRADE"!=e&&"ADDALINE"!=e&&!t}navigateUrl(e,t){let o="",r="";if(e){const e=t?.split(",");e?.length&&(o=e?.[0],r=e?.[1])}else o=t||"";if((0,n.Bz)()&&e)return r;if(this.isCookiedUser){const t=window.location.href;return`${o}?state=${e?n.r0.urlEncode(JSON.stringify({bookmarkUrl:r})):n.r0.urlEncode(JSON.stringify({bookmarkUrl:t}))}`}return""}getTransactionType(e){switch(e.toLowerCase()){case"upgrade_intent":return"UPGRADE";case"aal_intent":return"ADDALINE";case"byod_intent":default:return(0,n.Bz)()?"ADDALINE":"ACTIVATION";case"guest_intent":return"ACTIVATION"}}}},190:function(e,t,o){o.d(t,{y:function(){return a}});var n=o(4917),r=o(4674);const i={appName:"phoenix-upper-funnel",className:"TransactionStore"};class a{async getTransactionType(){const e=await window.phoenix.persistedState.get(r.M.TRANSACTION_TYPE);return await this.verifyTransactionType(e)}async setTransactionType(e){"AAL"===e&&(e="ADDALINE"),this.setMyTmo2TmoCookieByApiTransactionType(e),await window.phoenix.persistedState.set(r.M.TRANSACTION_TYPE,e)}async verifyTransactionType(e){const t=(0,n.Bz)();let o=!0;e||(o=!1),t&&"ACTIVATION"===e&&(o=!1),t||"UPGRADE"!==e&&"ADDALINE"!==e||(o=!1);const r=this.isCookieValid(t);if(o&&e)return r||await this.setTransactionType(e),e;let i;if(r)if(t){const e=this.getMyTmo2TmoCookie();i="UPGRADE"===e?"UPGRADE":"ADDALINE"}else i="ACTIVATION";else i=t?"ADDALINE":"ACTIVATION";return await this.setTransactionType(i),i}getMyTmo2TmoCookie(){try{if(window.Cookies.get("mytmo2tmo")){let e=JSON.parse(window.Cookies.get("mytmo2tmo"))?.transactionType;return e?("AAL"===e&&(e="ADDALINE"),e):null}return null}catch(e){return window.phoenix.log.error("Unable to find mytmo2tmo cookie",i),null}}isCookieValid(e){const t=this.getMyTmo2TmoCookie();if(!t)return!1;let o=!0;return"AAL"!==t&&"ADDALINE"!==t&&"UPGRADE"!==t&&(o=!1),e?"UPGRADE"!==t&&"AAL"!==t&&"ADDALINE"!==t&&(o=!1):"AAL"!==t&&"ADDALINE"!==t&&"UPGRADE"!==t||(o=!1),o}setMyTmo2TmoCookieByApiTransactionType(e){"ADDALINE"===e&&this.setMyTmo2TmoCookie("ADDALINE"),"ACTIVATION"===e&&this.setMyTmo2TmoCookie("ACTIVATION"),"UPGRADE"===e&&this.setMyTmo2TmoCookie("UPGRADE"),window.Cookies.remove("mytmo2tmo")}setMyTmo2TmoCookie(e){if("ADDALINE"===e&&(e="AAL"),"ACTIVATION"!=e){window.Cookies.withConverter({write:e=>e}).set("mytmo2tmo",`{"transactionType":"${e}"}`,{domain:".t-mobile.com"})}else window.Cookies.remove("mytmo2tmo")}}},2482:function(e,t,o){o.d(t,{B:function(){return n}});class n{_currentURL;_started;constructor(){window?.location.href?this._currentURL=new URL(window.location.href):this._currentURL=new URL("https://www.t-mobile.com"),this._started=!1}start(){this._started||(this._started=!0,window.phoenix.bus.subscribe("BROWSER_URL","UPDATE_URL",this.onUpdateURL.bind(this)))}get currentURL(){return this._currentURL}onUpdateURL(e){if(e?.payload){const{origin:t,pathname:o,searchParams:n}=new URL(window.location.href);let r=`?sku=${e.payload}`;"true"===n?.get("isNonStandAloneAccessory")&&(r+="&isNonStandAloneAccessory=true");`${t}${o}${r}`!=window.location.href&&(window.history.pushState({},"",`${t}${o}${r}`),this._currentURL=new URL(window.location.href),window.phoenix.bus.publish("BROWSER_URL","URL_CHANGED",{payload:this._currentURL}))}}}},2780:function(e,t,o){Object.defineProperty(t,"__esModule",{value:!0});const n=o(1635);n.__exportStar(o(6604),t),n.__exportStar(o(9237),t),n.__exportStar(o(2971),t),n.__exportStar(o(3586),t),n.__exportStar(o(3455),t)},6604:function(e,t,o){Object.defineProperty(t,"__esModule",{value:!0}),t.PhoenixService=void 0;const n=o(9237),r=o(2971),i=o(3586),a={appName:"phoenix-frontend-tooling",className:"PhoenixService"};t.PhoenixService=class{name;ufsAkmid="APM0228201";config;updateConfig;getConfig;isAuthorMode;putConfig;additionalRequestHeaders={};constructor(e,t){if(this.config=t||(0,r.findConfig)(e),!this.config)throw new Error(`${e.toString()} was not found. Unable to start the service.`);a.className=`${a.className}-${this.config.serviceName}`,this.isAuthorMode=this.setAuthorMode(),this.name=Symbol.for(`${this.config.serviceName} Service`)}setAuthorMode(){const e=document.querySelector("body");return"EDIT"===e?.dataset.wcmMode}async getData(e){if(!this.getConfig)throw new Error("No Get Method Defined");const t=e?.queryParameters?`?${e.queryParameters}`:"",o=`${this.getConfig?.basePath}/${this.getConfig?.servicePath}`+t,n={...this.getConfig?.headers?this.getConfig.headers:{},...this.additionalRequestHeaders},r=new Headers(n).get("transactionId")||window.uuid.v4(),i=performance.now();try{const t=await fetch(o,{method:"GET",body:JSON.stringify(e?.body),headers:n}),s=performance.now()-i,c=await t.json();if(t.ok){const i=await this.createClearwaterLog(r,JSON.stringify(e?.body),"GET",s,t.status,"Success",JSON.stringify(t),t.headers,`Success submitting the query to ${o} recieved ${t.status}`,o,this.convertHeadersToRecord(n));return window.phoenix.log.clearwater(i,a),c}{const i=`Error in GETDATA path of ${o} with response status of ${t.status}.`,c=await this.createClearwaterLog(r,JSON.stringify(e?.body),"GET",s,t.status,"Fault",JSON.stringify(t),t.headers,i,o,this.convertHeadersToRecord(n));throw window.phoenix.log.clearwater(c,a),new Error(i)}}catch(e){throw await this.handleErrorLogging(r,e,t,i,o,"GET",this.convertHeadersToRecord(n)),e}}async updateData(e){if(!this.updateConfig)throw new Error("No Update Method Defined");const t=e?.queryParameters?`?${e.queryParameters}`:"",o=`${this.updateConfig?.basePath}/${this.updateConfig?.servicePath}`+t,n={...this.updateConfig?.headers?this.updateConfig.headers:{},...this.additionalRequestHeaders},r=new Headers(n).get("transactionId")||window.uuid.v4(),i=performance.now();try{const t=await fetch(o,{method:"POST",body:JSON.stringify(e?.body),headers:n}),s=performance.now()-i,c=await t.json();if(t.ok){const i=await this.createClearwaterLog(r,JSON.stringify(e?.body),"POST",s,t.status,"Success",JSON.stringify(t),t.headers,`Success submitting the query to ${o} recieved ${t.status}`,o,this.convertHeadersToRecord(n));return window.phoenix.log.clearwater(i,a),c}{const i=`Error in UPDATEDATA path of ${o} recieved response status of ${t.status}.`,c=await this.createClearwaterLog(r,JSON.stringify(e?.body),"POST",s,t.status,"Fault",JSON.stringify(t),t.headers,i,o,this.convertHeadersToRecord(n));throw window.phoenix.log.clearwater(c,a),new Error(i)}}catch(t){throw await this.handleErrorLogging(r,t,JSON.stringify(e?.body),i,o,"POST",this.convertHeadersToRecord(n)),t}}async makeGqlQuery(e,t,o){const n=await(0,i.ufsHeaders)(),r=window.phoenix.configs?.apiDomainsConfigs?.graphql?.targetDomain,s=window.phoenix.configs?.apiDomainsConfigs?.graphql?.apiPath;r&&s||window.phoenix.log.warning("Warning: Missing GQL Domain or Path from configs",{...a,methodName:"makeGqlQuery"});const c=performance.now(),u=JSON.stringify({query:e,variables:t}),d={Accept:"application/json",...n,...o};try{const t=await fetch(`${r}${s}`,{method:"POST",headers:d,credentials:"omit",body:u}),o=performance.now()-c,i=await t.json();if(t.ok){const e=await this.createClearwaterLog(n["activity-id"],u,"POST",o,200,"Success",JSON.stringify(i),t.headers,"GQL success",`${r}${s}`,d);return window.phoenix.log.clearwater(e,{...a,methodName:"makeGQLQuery"}),i}{const c=`Error in GraphQL call of ${e} recieved response status of ${t.status}.`,l=await this.createClearwaterLog(n["activity-id"],u,"POST",o,200,"Error",JSON.stringify(i),t.headers,"GQL failure",`${r}${s}`,d);throw window.phoenix.log.clearwater(l,{...a,methodName:"makeGQLQuery"}),new Error(c)}}catch(e){throw await this.handleErrorLogging(n["activity-id"],e,u,c,`${r}${s}`,"POST",d),e}}async makePutRequest(e){if(!this.putConfig)throw new Error("No Update Method Defined");const t=e?.queryParameters?`?${e.queryParameters}`:"",o=`${this.putConfig?.basePath}/${this.putConfig?.servicePath}`+t,n={...this.putConfig?.headers?this.putConfig.headers:{},...this.additionalRequestHeaders},r=new Headers(n).get("transactionId")||window.uuid.v4(),i=performance.now();try{const t=await fetch(o,{method:"PUT",body:JSON.stringify(e?.body),headers:n}),s=performance.now()-i,c=await t.json();if(t.ok){const i=await this.createClearwaterLog(r,JSON.stringify(e?.body),"PUT",s,t.status,"Success",JSON.stringify(t),t.headers,`Success submitting the query to ${o} recieved ${t.status}`,o,this.convertHeadersToRecord(n));return window.phoenix.log.clearwater(i,a),c}{const i=`Error in UPDATEDATA path of ${o} recieved response status of ${t.status}.`,c=await this.createClearwaterLog(r,JSON.stringify(e?.body),"PUT",s,t.status,"Fault",JSON.stringify(t),t.headers,i,o,this.convertHeadersToRecord(n));throw window.phoenix.log.clearwater(c,a),new Error(i)}}catch(t){const s=await this.createClearwaterLog(r,JSON.stringify(e?.body),"POST",performance.now()-i,599,"Fault","unknown",null,`Error submitting the query to ${o}`,o,this.convertHeadersToRecord(n));throw window.phoenix.log.clearwater(s,a),t}}async createClearwaterLog(e,t,o,r,i,s,c,u,d,l,p,h){const f={};u&&u.forEach(((e,t)=>{f[t]=e}));const w=window.Cookies.get("id_token")||window.Cookies.get("a_token");let y="";if(w)try{const e=await(0,n.decodeJWT)(w);y=e?.usn||""}catch(e){window.phoenix.log.warning("Error decoding token:",a,e)}return{RequestId:e,RequestTime:(new Date).toString(),Sender:y,SenderType:"USER",Method:o,Receiver:this.ufsAkmid,Duration:r,ResponseStatusCode:i,Result:s,RequestHeaders:p||{},RequestBody:t,ResponseHeaders:f,ResponseBody:c,TargetEndpoint:window.location.origin+l,msg:d,obj:h}}addRequestHeaders(e){this.additionalRequestHeaders=e}convertHeadersToRecord(e){const t={},o=e;for(const e in o)Object.prototype.hasOwnProperty.call(o,e)&&(t[e]=o[e]);return t}async handleErrorLogging(e,t,o,n,r,i,s){if(t instanceof Error&&!t?.message.match(/with response status/gi)){const t=await this.createClearwaterLog(e,o,i,performance.now()-n,599,"Fault","unknown",null,`Error submitting the query to ${r}`,r,s);window.phoenix.log.clearwater(t,a)}throw t}start(){this.isAuthorMode?window.phoenix.log.warning("Author Mode detected, stopping api calls!",a):this.setupMethods()}stop(){}setupMethods(){this.config?.methods.forEach((e=>{switch(e.method){case"GET":this.getConfig=e;break;case"POST":this.updateConfig=e;break;case"PUT":this.putConfig=e}}))}}},3455:function(e,t){Object.defineProperty(t,"__esModule",{value:!0})},9237:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.decodeJWT=void 0;t.decodeJWT=async e=>{try{const t=e.split(".")[1],o=t?.replace(/-/g,"+").replace(/_/g,"/"),n=decodeURIComponent(window.atob(o).split("").map((function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)})).join(""));return Promise.resolve(JSON.parse(n))}catch(t){throw new Error(`Unable to parse token! ${t}; Using provided token: ${e}`)}}},2971:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.findConfig=void 0,t.findConfig=function(e){if(window?.phoenix?.configs?.serviceConfigs){const t=window.phoenix.configs.serviceConfigs.filter((t=>t.serviceName.toLowerCase()===e.toString().toLowerCase()));return 1===t.length?t[0]:void 0}}},3586:function(e,t,o){Object.defineProperty(t,"__esModule",{value:!0}),t.ufsHeaders=void 0;const n=o(9237);let r={"Content-Type":"application/json","session-id":"","interaction-id":"","workflow-id":"","sub-workflow-id":"","activity-id":"","channel-id":"WEB","application-id":"APM0226219-PHX","service-transaction-id":"",timestamp:"","origin-application-id":"APM0226219-PHX"};t.ufsHeaders=async e=>{if(e){const t=window.phoenix.configs?.usGraphConfigs?.find((t=>t?.intent?.toUpperCase()===e.toUpperCase()))?.headers;t&&(r=t)}const t=await window.phoenix.persistedState.get("PDP_TRANSACTION_TYPE");r["workflow-id"]=t||"UPGRADE","UPGRADE"===r["workflow-id"]?r["interaction-id"]="097ebb03-fdde-454b-89bb-257d74677019":r["interaction-id"]=window.uuid.v4();const o=document?.head?.dataset.analyticsPagePagename;r["sub-workflow-id"]=o||"unknown",r["service-transaction-id"]=window.uuid.v4(),r["activity-id"]=window.uuid.v4();const i=window.Cookies.get("id_token")?window.Cookies.get("id_token"):window.Cookies.get("a_token");if(i){const e=await(0,n.decodeJWT)(i);e&&e?.usn&&(r["session-id"]=e.usn),r["session-id"]||(r["session-id"]=window.uuid.v4())}else r["session-id"]=window.uuid.v4();return r.timestamp=(new Date).toISOString(),r}},2666:function(e,t,o){Object.defineProperty(t,"__esModule",{value:!0});const n=o(1635);n.__exportStar(o(3552),t),n.__exportStar(o(5055),t),n.__exportStar(o(2654),t),n.__exportStar(o(7691),t),n.__exportStar(o(5273),t),n.__exportStar(o(1858),t),n.__exportStar(o(6427),t),n.__exportStar(o(771),t),n.__exportStar(o(3799),t),n.__exportStar(o(5483),t),n.__exportStar(o(7360),t),n.__exportStar(o(2690),t),n.__exportStar(o(9582),t),n.__exportStar(o(3124),t)},3552:function(e,t){Object.defineProperty(t,"__esModule",{value:!0})},5055:function(e,t){Object.defineProperty(t,"__esModule",{value:!0})},2654:function(e,t){Object.defineProperty(t,"__esModule",{value:!0});t.default=class{constructor(e){const t={appName:"phoenix",className:Symbol.keyFor(e)??"Error no ClassName"};window.phoenix.log.info(`${e.toString()} Starting`,t)}handleErrors(){}}},7691:function(e,t,o){Object.defineProperty(t,"__esModule",{value:!0}),t.PhoenixService=void 0;var n=o(2780);Object.defineProperty(t,"PhoenixService",{enumerable:!0,get:function(){return n.PhoenixService}})},5273:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,o,...n){if(!e)throw"startFunc is not defined";t||(t="unassigned"),o||(o="unassigned");const r={appName:o,className:t};let i=null;try{return i=n?new e(...n):new e,window.phoenix.log.debug(`Started ${t}.`,r),i}catch(e){return window.phoenix.log.error(`Error Starting service ${e}`,r,{exception:e}),i}}},1858:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.productTypeFromCategory=t.productFamilyCategoryMapper=void 0;t.productFamilyCategoryMapper=e=>{const t=e.pathname;if(t.match(/\/cellphone\/|\/cellphones\/|\/cell-phones\/|\/cell-phone\/|\/cell-phones$/gi))return"CELLPHONES";if(t.match(/\/tablet\/|\/tablets\/|\/tablets$/gi))return"TABLETS";if(t.match(/\/smart-watch\/|\/smartwatches\/|\/smart-watches$/gi))return"SMARTWATCHES";if(t.match(/\/hotspot-iot-connected-device\/|\/hotspots-iot-connected-devices\/|\/hotspot-iot-connected-devices\/|\/hotspots-iot-connected-devices$|\/hotspots_iot_connected_devices$/gi))return"HOTSPOTS_IOT_CONNECTED_DEVICES";return t.match(/\/accessory\/|\/accessoriess\/|\/accessories$/gi)?"ACCESSORIES":null};t.productTypeFromCategory=e=>{if("CELLPHONES"===e)return"Cell Phone";if("TABLETS"===e)return"Tablet";if("SMARTWATCHES"===e)return"Smart Watch";if("HOTSPOTS_IOT_CONNECTED_DEVICES"===e)return"HotSpot & IoT";return"ACCESSORIES"===e?"Accessory":null}},6427:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.correlationIdCheck=void 0,t.correlationIdCheck=async function(e){let t=await window.localforage.getItem("HSIcorrelationId");t||(t=window.uuid.v4(),await window.localforage.setItem("HSIcorrelationId",t)),e.correlationId=t}},771:function(e,t,o){Object.defineProperty(t,"__esModule",{value:!0}),t.decodeJWT=void 0;var n=o(2780);Object.defineProperty(t,"decodeJWT",{enumerable:!0,get:function(){return n.decodeJWT}})},3799:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.arrayBufferFromBase64=t.downloadPDFromBase64=void 0;t.downloadPDFromBase64=(e,o)=>{const n=(0,t.arrayBufferFromBase64)(e),r=new Blob([n],{type:"application/pdf"}),i=window.URL.createObjectURL(r),a=document.createElement("a");a.href=i,a.download=`${o}.pdf`,a.click(),window.URL.revokeObjectURL(i),a.remove()};t.arrayBufferFromBase64=e=>{const t=window.atob(e),o=t.length,n=new Uint8Array(o);for(let e=0;e{window.phoenix.bus.publish("GRAPHQL","GRAPHQL_REQUEST",{payload:{query:e.replace(/(\r\n|\n|\r)/gm,"").trim(),identifier:t,variables:o,headers:n,channel:r,topic:i}})};t.getGraphQLError=e=>{const t=e?.error,o=t?.[0]?.message;return{code:t?.[0]?.extensions?.code||t?.code,message:o}}},7360:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.applyScrollMarginTop=void 0,t.applyScrollMarginTop=function(e={}){const{marginTop:t,timeout:o}=e,n=()=>{const e=(parseInt(document.documentElement.style.getPropertyValue("--js--header-height-overall"),10)||0)+parseInt(t||"0",10);if(e>0){const t=document.createElement("style");t.innerHTML=`:target { scroll-margin-top: ${e}px; }`,document.head.appendChild(t)}};"number"==typeof o?setTimeout(n,o):n()}},2690:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.safeJsonParse=void 0,t.safeJsonParse=function(e){try{return JSON.parse(e)}catch(t){return window.phoenix.log.warning(`Error parsing JSON string ${e}`,{appName:"phoenix-frontend-tooling",className:"ES Module - JSON utils",methodName:"safeJsonParse"}),{}}}},9582:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.formatPhoneNumber=void 0,t.formatPhoneNumber=function(e){if(null==e)return;const t=e.replace(/\D/g,"");if(10!==t.length)return;const o=t.match(/^(\d{3})(\d{3})(\d{4})$/);return`(${o[1]}) ${o[2]}-${o[3]}`}},3124:function(e,t,o){Object.defineProperty(t,"__esModule",{value:!0}),t.ufsHeaders=void 0;var n=o(2780);Object.defineProperty(t,"ufsHeaders",{enumerable:!0,get:function(){return n.ufsHeaders}})},1635:function(e,t,o){o.r(t),o.d(t,{__addDisposableResource:function(){return x},__assign:function(){return i},__asyncDelegator:function(){return C},__asyncGenerator:function(){return b},__asyncValues:function(){return O},__await:function(){return m},__awaiter:function(){return f},__classPrivateFieldGet:function(){return D},__classPrivateFieldIn:function(){return L},__classPrivateFieldSet:function(){return R},__createBinding:function(){return y},__decorate:function(){return s},__disposeResources:function(){return M},__esDecorate:function(){return u},__exportStar:function(){return _},__extends:function(){return r},__generator:function(){return w},__importDefault:function(){return N},__importStar:function(){return I},__makeTemplateObject:function(){return v},__metadata:function(){return h},__param:function(){return c},__propKey:function(){return l},__read:function(){return T},__rest:function(){return a},__runInitializers:function(){return d},__setFunctionName:function(){return p},__spread:function(){return g},__spreadArray:function(){return P},__spreadArrays:function(){return S},__values:function(){return E}});var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])},n(e,t)};function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}var i=function(){return i=Object.assign||function(e){for(var t,o=1,n=arguments.length;o=0;s--)(r=e[s])&&(a=(i<3?r(a):i>3?r(t,o,a):r(t,o))||a);return i>3&&a&&Object.defineProperty(t,o,a),a}function c(e,t){return function(o,n){t(o,n,e)}}function u(e,t,o,n,r,i){function a(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var s,c=n.kind,u="getter"===c?"get":"setter"===c?"set":"value",d=!t&&e?n.static?e:e.prototype:null,l=t||(d?Object.getOwnPropertyDescriptor(d,n.name):{}),p=!1,h=o.length-1;h>=0;h--){var f={};for(var w in n)f[w]="access"===w?{}:n[w];for(var w in n.access)f.access[w]=n.access[w];f.addInitializer=function(e){if(p)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(e||null))};var y=(0,o[h])("accessor"===c?{get:l.get,set:l.set}:l[u],f);if("accessor"===c){if(void 0===y)continue;if(null===y||"object"!=typeof y)throw new TypeError("Object expected");(s=a(y.get))&&(l.get=s),(s=a(y.set))&&(l.set=s),(s=a(y.init))&&r.unshift(s)}else(s=a(y))&&("field"===c?r.unshift(s):l[u]=s)}d&&Object.defineProperty(d,n.name,l),p=!0}function d(e,t,o){for(var n=arguments.length>2,r=0;r0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function T(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var n,r,i=o.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){r={error:e}}finally{try{n&&!n.done&&(o=i.return)&&o.call(i)}finally{if(r)throw r.error}}return a}function g(){for(var e=[],t=0;t1||s(e,t)}))},t&&(n[e]=t(n[e])))}function s(e,t){try{(o=r[e](t)).value instanceof m?Promise.resolve(o.value.v).then(c,u):d(i[0][2],o)}catch(e){d(i[0][3],e)}var o}function c(e){s("next",e)}function u(e){s("throw",e)}function d(e,t){e(t),i.shift(),i.length&&s(i[0][0],i[0][1])}}function C(e){var t,o;return t={},n("next"),n("throw",(function(e){throw e})),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,r){t[n]=e[n]?function(t){return(o=!o)?{value:m(e[n](t)),done:!1}:r?r(t):t}:r}}function O(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,o=e[Symbol.asyncIterator];return o?o.call(e):(e=E(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(o){t[o]=e[o]&&function(t){return new Promise((function(n,r){(function(e,t,o,n){Promise.resolve(n).then((function(t){e({value:t,done:o})}),t)})(n,r,(t=e[o](t)).done,t.value)}))}}}function v(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var A=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function I(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o in e)"default"!==o&&Object.prototype.hasOwnProperty.call(e,o)&&y(t,e,o);return A(t,e),t}function N(e){return e&&e.__esModule?e:{default:e}}function D(e,t,o,n){if("a"===o&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===o?n:"a"===o?n.call(e):n?n.value:t.get(e)}function R(e,t,o,n,r){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?r.call(e,o):r?r.value=o:t.set(e,o),o}function L(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)}function x(e,t,o){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var n,r;if(o){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=t[Symbol.asyncDispose]}if(void 0===n){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=t[Symbol.dispose],o&&(r=n)}if("function"!=typeof n)throw new TypeError("Object not disposable.");r&&(n=function(){try{r.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:n,async:o})}else o&&e.stack.push({async:!0});return t}var U="function"==typeof SuppressedError?SuppressedError:function(e,t,o){var n=new Error(o);return n.name="SuppressedError",n.error=e,n.suppressed=t,n};function M(e){function t(t){e.error=e.hasError?new U(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}return function o(){for(;e.stack.length;){var n=e.stack.pop();try{var r=n.dispose&&n.dispose.call(n.value);if(n.async)return Promise.resolve(r).then(o,(function(e){return t(e),o()}))}catch(e){t(e)}}if(e.hasError)throw e.error}()}t.default={__extends:r,__assign:i,__rest:a,__decorate:s,__param:c,__metadata:h,__awaiter:f,__generator:w,__createBinding:y,__exportStar:_,__values:E,__read:T,__spread:g,__spreadArrays:S,__spreadArray:P,__await:m,__asyncGenerator:b,__asyncDelegator:C,__asyncValues:O,__makeTemplateObject:v,__importStar:I,__importDefault:N,__classPrivateFieldGet:D,__classPrivateFieldSet:R,__classPrivateFieldIn:L,__addDisposableResource:x,__disposeResources:M}}},t={};function o(n){var r=t[n];if(void 0!==r)return r.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,o),i.exports}o.d=function(e,t){for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n=o(7691),r=o(4917),i=o(2666);const a="t-mobile_market",s=["pr","vi"];function c(e){switch(!0){case e>=0&&e<=15:return"0-15";case e>15&&e<=30:return"15-30";case e>30&&e<=50:return"30-50";case e>50&&e<=80:return"50-80";case e>80:return"80-plus";default:return"0-15"}}const u=e=>{const t=e.pathname;if(t.match(/\/cellphone\/|\/cellphones\/|\/cell-phones\/|\/cell-phone\/|\/cell-phones$/gi))return"CELLPHONES";if(t.match(/\/tablet\/|\/tablets\/|\/tablets$/gi))return"TABLETS";if(t.match(/\/smart-watch\/|\/smartwatches\/|\/smart-watches\/|\/smart-watches$/gi))return"SMARTWATCHES";if(t.match(/\/hotspot-iot-connected-device\/|\/hotspots-iot-connected-devices\/|\/hotspot-iot-connected-devices\/|\/hotspots-iot-connected-devices$|\/hotspots_iot_connected_devices$/gi))return"HOTSPOTS_IOT_CONNECTED_DEVICES";return t.match(/\/accessory\/|\/accessories\/|\/accessories$/gi)?"ACCESSORIES":null};var d=o(3898),l=o(190),p=o(2482),h=o(4674);const f="PROSPECT_FLOW_NAME",w="BASE_FLOW_NAME",y={appName:"phoenix-upper-funnel",className:"ProductListingPageOrchestrator"};class _{productPricingService;deviceCompatibilityService;urlService;plpIntentService;transactionStore;closeIntentModalUnsubscribe;constructor(){const e={serviceName:"products pricing",methods:[{subscribeChannel:"PRODUCT_PRICING",subscribeTopic:"FETCH_PRODUCT_PRICING",publishChannel:"PRODUCT_PRICING",publishTopic:"PRODUCT_PRICING_FETCHED",method:"GET",basePath:"/self-service-commerce/v1",servicePath:"products-pricing",headers:{"Content-Type":"application/json",transactionId:window.uuid.v4(),correlationId:"",channelId:"WEB",applicationId:"TMO"},payload:""}]};this.productPricingService=new n.PhoenixService("products-pricing",e);const t={serviceName:"device compatibility",methods:[{subscribeChannel:"DEVICE_COMPATIBILITY",subscribeTopic:"FETCH_DEVICE_COMPATIBILITY",publishChannel:"DEVICE_COMPATIBILITY",publishTopic:"DEVICE_COMPATIBILITY_FETCHED",method:"POST",basePath:"/self-service-shop/v1",servicePath:"accessories-by-relationship",headers:{"Content-Type":"application/json",transactionId:window.uuid.v4(),correlationId:"",channelId:"WEB",applicationId:"TMO"},payload:""}]};this.deviceCompatibilityService=new n.PhoenixService("accessories-by-relationship",t),this.urlService=new p.B,this.plpIntentService=new d.u,this.transactionStore=new l.y,this.closeIntentModalUnsubscribe=window.phoenix.bus.subscribe("MODAL","CLOSE",this.intentModalClose.bind(this))}async start(){const e=this.urlService.currentURL.searchParams?.get("INTNAV")?.toLowerCase();window.phoenix.checkFeatureFlag("isDCCWaiverEnabled")&&e?.includes("upgrade")&&(await this.transactionStore.setTransactionType("UPGRADE"),await window.phoenix.persistedState.set(h.M.UPF_EXPERIENCE,"UPGRADE"));const t=this.transactionStore.getMyTmo2TmoCookie(),o=this.plpIntentService.shouldOpenModal(t);await this.transactionStore.getTransactionType()&&(this.events(o),this.urlService.start(),"CELLPHONES"===u(this.urlService.currentURL)&&await async function(){const e=window.Cookies.get(a);if(e)return void await window.phoenix.persistedState.set(a,e);const t=(new URL(window.location.href).searchParams.get("region")??"").toLowerCase();s.includes(t)&&await window.phoenix.persistedState.set(a,JSON.stringify({region:t}))}(),await this.productPricingService.start(),await this.getProductMetaData(this.urlService.currentURL),await this.deviceCompatibilityService.start(),"CELLPHONES"===u(this.urlService.currentURL)&&(0,r.Bz)()&&t&&"UPGRADE"===t&&window.phoenix.bus.publish("SHOW_HIDE","TOGGLE",{payload:{show:["plp-upgrade-line-selector"]}})),await window.phoenix.persistedState.set("PHX_EXPERIENCE",!0)}events(e){window.phoenix.bus.subscribe("BROWSER_URL","URL_CHANGED",this.onURLChanged.bind(this)),e?(window.phoenix.bus.publish("INTENT_SELECTION_MODAL","INTENT_SELECTION_LOAD"),window.phoenix.bus.subscribe("INTENT_SELECTION_MODAL",["INTENT_UPGRADE_SELECTION","INTENT_AAL_SELECTION","INTENT_BYOD_SELECTION","INTENT_GUEST_SELECTION"],this.setIntentAndRedirect.bind(this))):this.closeIntentModalUnsubscribe(),window.phoenix.bus.subscribe("PRODUCT_FILTER","DEVICE_COMPATIBILITY",this.addDeviceCompatibilityFilter.bind(this)),window.phoenix.bus.subscribe("LINE_SELECTOR","UPDATE_CUSTOMER_INFO",this.updateCustomerInfo.bind(this)),window.phoenix.bus.subscribe("PDP_CHANNEL","ADD-LINE-INSTEAD",this.onAALSelect.bind(this))}async getProductMetaData(e){if(!e)return void this.handleErrors();const t=u(e);if(t)try{this.emitFamilyCategory(t);const e=await this.transactionStore.getTransactionType(),o={queryParameters:`familyCategory=${t}&transactionType=${e}`},n=(e=>{const t={},o=Array.from(document.querySelectorAll("[data-upf-plp-card-filter]")),n=window.phoenix.checkFeatureFlag("isDCCWaiverEnabled"),r=sessionStorage.getItem("loginSessionInfo");let i="";r&&(i=JSON.parse(r)?.userInfo?.profile?.accountTypeSubType??"");const a=(new URL(window.location.href).searchParams.get("INTNAV")??"").includes("Upgrade"),s="SY"===i,u=n&&"ACCESSORIES"!==e.productFamilyCategory;return e.productPricingResponse.forEach((n=>{let r="",i="";n.frpPrice?.[0]?.discountPercent>0&&(r=n.frpPrice?.[0].displaySalePrice);const d=n?.crpPrices?.[0]?.[0]?.monthlyPayment?.discountedMonthlyAmount,l="number"==typeof d;"UPGRADE"===e.transactionType&&l&&(i=d.toFixed(2));const p=o.find((e=>e?.dataset?.upfPlpCardSku===n.defaultSku)),h=p?.dataset?.upfPlpCardFilter?.includes("watchOS")||p?.dataset?.upfPlpCardFilter?.includes("iPadOS"),f=u&&h,w=u&&!f&&!s&&("UPGRADE"===e.transactionType||a),y=u&&!f&&!w&&(s||!s&&("ACTIVATION"===e.transactionType||"ADDALINE"===e.transactionType));t[n.defaultSku]={pricing:{promoValue:n.crpPrices[0].length>0?n.crpPrices[0][0].monthlyPayment.displaySalePrice:"",promoDuration:n.crpPrices[0].length>0?n.crpPrices[0][0].contractTerm?.toString():"",dueToday:n.crpPrices[0].length>0?n.crpPrices[0][0].displayDownPayment:"",payInFull:n.frpPrice[0].displayListPrice,priceRange:c(n.frpPrice[0].salePrice),salePrice:r,monthlyListPrice:i},promos:n.promotions,isAppleBTSDevice:f,isDccUpgradeEnabled:w,isDccAALEnabled:y}})),t})({productPricingResponse:await this.productPricingService.getData(o),transactionType:e,productFamilyCategory:t});window.phoenix.bus.publish("PRODUCT_GRID","LOAD_METADATA",{payload:{data:n}}),"ACCESSORIES"===t&&await this.handleAccessories()}catch(e){window.phoenix.log.error("Error getting product metadata",y,e),this.handleErrors()}else this.handleErrors()}async onURLChanged(e){e?.payload&&await this.getProductMetaData(e.payload)}async handleAccessories(){const e=await window.phoenix.persistedState.get(h.M.SELECTED_PAYMENT_OPTION);"EIP"!==e&&"FULL"!==e||(await window.phoenix.persistedState.del(h.M.SELECTED_PAYMENT_OPTION),this.setAccessoryModalContent(e),window.phoenix.bus.publish("ACCESSORIES","DISPLAY_ACCESSORIES_MODAL"),window.phoenix.bus.subscribe("ACCESSORIES","CONTINUE_TO_CART_CLICK",this.handleCartAccessoriesButton.bind(this)))}setAccessoryModalContent(e){"EIP"===e?(window.phoenix.bus.publish("SHOW_HIDE","TOGGLE",{payload:{show:["accessories-pay-monthly"]}}),window.phoenix.bus.publish("SHOW_HIDE","TOGGLE",{payload:{hide:["accessories-pay-full"]}})):(window.phoenix.bus.publish("SHOW_HIDE","TOGGLE",{payload:{hide:["accessories-pay-monthly"]}}),window.phoenix.bus.publish("SHOW_HIDE","TOGGLE",{payload:{show:["accessories-pay-full"]}}))}handleCartAccessoriesButton(e){const t=e?.payload?.data;t&&(window.location.href=t)}intentModalClose(){this.closeIntentModalUnsubscribe();document.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')[0].focus()}async updateCustomerInfo(e){await async function(e){const t=e?.payload?.phoneNumber;await window.phoenix.persistedState.set(h.M.UPGRADE_CUSTOMER_INFO,e?.payload),window.phoenix.bus.publish("PDP_RTE_CHANNEL","UPGRADE_CUSTOMER_INFO",{payload:{...e?.payload,phoneNumber:t&&(0,i.formatPhoneNumber)(t)}})}({payload:e?.payload})}async onAALSelect(){this.transactionStore.setMyTmo2TmoCookieByApiTransactionType("ADDALINE"),await window.phoenix.persistedState.set(h.M.TRANSACTION_TYPE,"ADDALINE"),window.phoenix.bus.publish("SHOW_HIDE","TOGGLE",{payload:{hide:["plp-upgrade-line-selector"]}}),window.phoenix.bus.publish("MODAL","CLOSE")}async setIntentAndRedirect(e){const t=e?.payload?.$el?.id,o=this.plpIntentService.getTransactionType(t);if(window.phoenix.bus.publish("MODAL","CLOSE"),(0,r.Bz)()){await window.phoenix.persistedState.get(f)&&await window.phoenix.persistedState.del(f);const e=t?.toLowerCase();let o;"aal_intent"===e||"byod_intent"===e?o="AAL":"upgrade_intent"===e&&(o="UPGRADE"),o&&await window.phoenix.persistedState.set(w,o),"UPGRADE"==o&&window.phoenix.bus.publish("SHOW_HIDE","TOGGLE",{payload:{show:["plp-upgrade-line-selector"]}})}!(0,r.Bz)()&&Boolean(window.Cookies.get("MyTMobile"))?window.Cookies.set("ShopIntent",o,{domain:".t-mobile.com"}):(await window.phoenix.persistedState.set(h.M.UPF_EXPERIENCE,o),await this.transactionStore.setTransactionType(o));const n="byod_intent"===t,i=e?.payload?.data;n&&i&&(window.location.href=this.plpIntentService.navigateUrl(n,i)),"guest_intent"!==t&&!(0,r.Bz)()&&i&&(window.location.href=this.plpIntentService.navigateUrl(n,i)),await this.getProductMetaData(this.urlService.currentURL)}handleErrors(){window.phoenix.bus.publish("ERROR","RUNTIME_NOTIFICATION",{payload:{logDetails:{appName:y.appName,className:y.className},errorPayload:{content:"GENERIC_ERROR",type:"WARNING"}}})}emitFamilyCategory(e){window.phoenix.bus.publish("PRODUCT_CATEGORIES","FETCH_FAMILY_CATEGORY_SUCCESS",{payload:{categoryName:e}})}async addDeviceCompatibilityFilter(e){let t=[];if(e?.payload?.value?.length){const o=await this.deviceCompatibilityService.updateData({body:{compatibleProductIds:e.payload.value.map((e=>e.value))}});t=o.familyCodes}window.phoenix.bus.publish("PRODUCT_GRID","ADD_DEVICE_COMPATIBILITY",{payload:t})}}try{(new _).start()}catch(e){window.phoenix.log.error("Error Starting Page Controller",y,e)}}();